<?php

function connect_db(){
	$link 	= mysql_connect("localhost",'root','') or die(mysql_error());
	$mydb	= mysql_select_db('spos') or die(mysql_error());
	return $link;
}

try 
{
	$link = connect_db();
} catch (Exception $e) {
	echo $e->getMessage();
}




?>